package com.sushe.service;

import com.sushe.dao.LoginDao;
import com.sushe.service.jiekou.LoginService;

import java.sql.SQLException;
import java.util.Scanner;

public class LoginServiceImpl implements LoginService {

    private LoginDao loginDao = new LoginDao();
    @Override
    public Integer login() throws SQLException, ClassNotFoundException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username=scanner.nextLine();
        System.out.println("请输入密码：");
        String password=scanner.nextLine();
        boolean flag=loginDao.select(username,password);
        if(flag){
            System.out.println("登录成功！");
            return 1;
        }
        System.out.println("用户名或密码错误！登陆失败！即将返回主页！");
        return 2;

    }
}
